package com.example.mobile2030606174mzq0603homework;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

public class MainActivity extends AppCompatActivity {
EditText text_two;
ImageView image_one;
Button button_one;
    int A = 1 ;
    int B = 0;
    int Z =1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        inview();
        button_one.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                  for (int i = 0; i < 8; i++) {

                      if (Z == 0) {
                          image_one.setImageResource(R.drawable.line01_01);
                          Z += 1;
                          break;
                      }
                          if (Z == 1) {
                          image_one.setImageResource(R.drawable.line01_02);
                          Z += 1;
                          break;

                      }
                      if (Z == 2) {
                          image_one.setImageResource(R.drawable.line01_03);
                          Z += 1;
                          break;

                      }
                      if (Z == 3) {
                          image_one.setImageResource(R.drawable.line01_04);
                          Z += 1;
                          break;

                      }
                      if (Z == 4) {
                          image_one.setImageResource(R.drawable.line01_05);
                          Z += 1;
                          break;

                      }
                      if (Z == 5) {
                          image_one.setImageResource(R.drawable.line01_06);
                          Z += 1;
                          break;
                      }
                      if (Z == 6) {
                          Z=0;
                          text_two.setText("到第6张时再按一下");
                          break;

                      }
                  }
            }
        });
    }
    private void inview(){
        text_two = findViewById(R.id.editTextTextPersonName);
        image_one = findViewById(R.id.imageButton2);
        button_one= findViewById(R.id.button);
    }
}